package com.ksm.client;

import java.util.List;

import com.google.gwt.user.client.ui.IsWidget;
import com.ksm.client.document.presenter.DocumentFormPresenter;
import com.ksm.client.document.presenter.DocumentGridPresenter;
import com.ksm.client.document.presenter.DocumentJustificatifPresenter;
import com.ksm.client.document.presenter.DocumentPreviewPresenter;
import com.ksm.client.document.presenter.DocumentSearchPresenter;
import com.ksm.client.presenter.MainPresenter;
import com.ksm.transfer.dto.DocumentDTO;
import com.ksm.transfer.dto.JustificatifDTO;
import com.ksm.transfer.dto.TvaDTO;
import com.ksm.transfer.dto.TypeDocumentDTO;
import com.mvp4g.client.annotation.Debug;
import com.mvp4g.client.annotation.Event;
import com.mvp4g.client.annotation.Events;
import com.mvp4g.client.annotation.Start;
import com.mvp4g.client.event.EventBus;

@Events(startPresenter = MainPresenter.class, historyOnStart = false, ginModules = ManagerGinModule.class)
@Debug
public interface ManagerEventBus extends EventBus {

	@Start
	@Event(handlers = MainPresenter.class, bind = { DocumentSearchPresenter.class, DocumentFormPresenter.class, DocumentGridPresenter.class,
			DocumentJustificatifPresenter.class, DocumentPreviewPresenter.class })
	void initApp();

	@Event(handlers = MainPresenter.class)
	void changeBody(IsWidget widget);

	@Event(handlers = DocumentGridPresenter.class)
	void documentGridUpdate(List<DocumentDTO> documents);

	@Event(handlers = { DocumentFormPresenter.class, DocumentJustificatifPresenter.class })
	void documentGridLoad(DocumentDTO documentDto);

	@Event(handlers = DocumentPreviewPresenter.class)
	void justificatifGridLoad(JustificatifDTO justificatifDTO);

	@Event(handlers = DocumentFormPresenter.class)
	void referentialTvaUpdate(List<TvaDTO> tvaDTOs);

	@Event(handlers = { DocumentFormPresenter.class, DocumentSearchPresenter.class })
	void referentialTypeDocumentUpdate(List<TypeDocumentDTO> typeDocumentDTOs);

	@Event(handlers = { DocumentFormPresenter.class, DocumentJustificatifPresenter.class, DocumentPreviewPresenter.class })
	void documentNewLoad();

	@Event(handlers = { DocumentGridPresenter.class })
	void documentSaved(DocumentDTO documentDto);
}
